package cn.wolfcode.luowowo.common.util;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class AjaxResult {
    private boolean success = true;
    private String msg;
    private Object data;
    private int code;

    public AjaxResult(){}
    public AjaxResult(boolean success){
        this.success=success;
    }
    public AjaxResult(boolean success,String msg){
        this.success= success;
        this.msg=msg;
    }
    public AjaxResult(int code){
        this.code=code;
    }

    //定义两个常量,一个成功一个失败
    public static final AjaxResult SUCCESS = new AjaxResult();
    public static final AjaxResult Fail = new AjaxResult(false);

    public AjaxResult addData(Object data){
        this.data=data;
        return this;
    }


}
